home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / pdcurs21.zip / PRIVATE.ZIP / _SETFONT.C < prev    next >
Text File  |  1992-11-21  |  4KB  |  138 lines

  1. #define        CURSES_LIBRARY  1
  2. #include <curses.h>
  3.  
  4. #ifndef NDEBUG
  5. char *rcsid__setfont = "$Header: c:/curses/private/RCS/_setfont.c%v 2.0 1992/11/15 03:24:36 MH Rel $";
  6. #endif
  7.  
  8.  
  9.  
  10.  
  11. /*man-start*********************************************************************
  12.  
  13.   PDC_set_font()       - sets the current font size
  14.  
  15.   PDCurses Description:
  16.        This is a private PDCurses function.
  17.  
  18.        This routine sets the current font size, if the adapter allows
  19.        such a change.
  20.  
  21.   PDCurses Return Value:
  22.        This function returns OK upon success otherwise ERR is returned.
  23.  
  24.   PDCurses Errors:
  25.        It is an error to attempt to change the font size on a "bogus"
  26.        adapter.  The reason for this is that we have a known video
  27.        adapter identity problem.  e.g. Two adapters report the same
  28.        identifying characteristics.
  29.  
  30.        It is also an error to attempt to change the size of the Flexos
  31.        console (as there is currently no support for that).
  32.  
  33.   Portability:
  34.        PDCurses        int     PDC_set_font( int size );
  35.  
  36. **man-end**********************************************************************/
  37.  
  38. int    PDC_set_font(int size)
  39. {
  40. #ifdef FLEXOS
  41.        return( ERR );
  42. #endif
  43. #ifdef DOS
  44.        if (_cursvar.bogus_adapter)
  45.                return( ERR );
  46.  
  47.        switch (_cursvar.adapter)
  48.        {
  49.        case _CGA:
  50.        case _MDA:
  51.        case _MCGACOLOR:
  52.        case _MCGAMONO:
  53.        case _MDS_GENIUS:
  54.                break;
  55.  
  56.        case _EGACOLOR:
  57.        case _EGAMONO:
  58.                if (_cursvar.sizeable && (_cursvar.font != size))
  59.                {
  60.                        switch (size)
  61.                        {
  62.                        case _FONT8:
  63.                                regs.h.ah = 0x11;
  64.                                regs.h.al = 0x12;
  65.                                regs.h.bl = 0x00;
  66.                                int86(0x10, ®s, ®s);
  67.                                break;
  68.                        case _FONT14:
  69.                                regs.h.ah = 0x11;
  70.                                regs.h.al = 0x11;
  71.                                regs.h.bl = 0x00;
  72.                                int86(0x10, ®s, ®s);
  73.                                break;
  74.                        default:
  75.                                break;
  76.                        }
  77.                }
  78.                break;
  79.  
  80.        case _VGACOLOR:
  81.        case _VGAMONO:
  82.                if (_cursvar.sizeable && (_cursvar.font != size))
  83.                {
  84.                        switch (size)
  85.                        {
  86.                        case _FONT8:
  87.                                regs.h.ah = 0x11;
  88.                                regs.h.al = 0x12;
  89.                                regs.h.bl = 0x00;
  90.                                int86(0x10, ®s, ®s);
  91.                                break;
  92.                        case _FONT14:
  93.                                regs.h.ah = 0x11;
  94.                                regs.h.al = 0x11;
  95.                                regs.h.bl = 0x00;
  96.                                int86(0x10, ®s, ®s);
  97.                                break;
  98.                        case _FONT16:
  99.                                regs.h.ah = 0x11;
  100.                                regs.h.al = 0x14;
  101.                                regs.h.bl = 0x00;
  102.                                int86(0x10, ®s, ®s);
  103.                                break;
  104.                        default:
  105.                                break;
  106.                        }
  107.                }
  108.                break;
  109.        default:
  110.                break;
  111.        }
  112.        if (_cursvar.visible_cursor)
  113.                curson();
  114.        else
  115.                cursoff();
  116.        _cursvar.font = PDC_get_font();
  117.        return( OK );
  118. #endif
  119. #ifdef OS2
  120.        VIOMODEINFO modeInfo;
  121.        if (_cursvar.sizeable && (_cursvar.font != size))
  122.        {
  123.               modeInfo.cb = sizeof(modeInfo);
  124.               /* set most parameters of modeInfo */
  125.               VioGetMode(&modeInfo, 0);
  126.               modeInfo.cb = 8;     /* ignore horiz an vert resolution */
  127.                modeInfo.row = modeInfo.vres / size;
  128.               VioSetMode(&modeInfo, 0);
  129.        }
  130.        if (_cursvar.visible_cursor)
  131.                curson();
  132.        else
  133.                cursoff();
  134.        _cursvar.font = PDC_get_font();
  135.        return( OK );
  136. #endif
  137. }
  138.